home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Blender 2.49b / blender-2.49b-windows.exe / $_4_ / .blender / scripts / colladaImport14.py < prev    next >
Text File  |  2009-08-31  |  4KB  |  138 lines

  1. #!BPY
  2.  
  3. """
  4. Name: 'COLLADA 1.4(.dae) ...'
  5. Blender: 241
  6. Group: 'Import'
  7. Tooltip: 'Import scene from COLLADA 1.4 format (.dae)'
  8. """
  9.  
  10. __author__ = "Illusoft - Pieter Visser"
  11. __url__ = ("Project homepage, http://colladablender.illusoft.com")
  12. __version__ = "0.3.160"
  13. __email__ = "colladablender@illusoft.com"
  14. __bpydoc__ = """\
  15.  
  16. Description: Imports a COLLADA 1.4 file into a Blender scene.
  17.  
  18. Bugs and Features: check the project website: http://colladablender.illusoft.com
  19.  
  20. Usage: Run the script from the menu or inside Blender.
  21. """
  22.  
  23. # --------------------------------------------------------------------------
  24. # Illusoft Collada 1.4 plugin for Blender
  25. # --------------------------------------------------------------------------
  26. # ***** BEGIN GPL LICENSE BLOCK *****
  27. #
  28. # Copyright (C) 2006: Illusoft - colladablender@illusoft.com
  29. # 2008.05.08 modif. for debug mode by migius (AKA Remigiusz Fiedler)
  30. #
  31. # This program is free software; you can redistribute it and/or modify
  32. # it under the terms of the GNU General Public License as published by
  33. # the Free Software Foundation; either version 2 of the License,
  34. # or (at your option) any later version.
  35. #
  36. # This program is distributed in the hope that it will be useful,
  37. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  38. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.    See the
  39. # GNU General Public License for more details.
  40. #
  41. # You should have received a copy of the GNU General Public License
  42. # along with this program; if not, write to the Free Software Foundation,
  43. # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  44. #
  45. # ***** END GPL LICENCE BLOCK *****
  46. # --------------------------------------------------------------------------
  47.  
  48. import sys
  49. import Blender
  50.  
  51. error = False
  52.  
  53. ######################## SET PATH TO FOLDER consisting 'colladaImEx' here (if necessary)
  54.  
  55. # Example:
  56.  
  57. # scriptsDir = "C:/Temp/"
  58.  
  59. scriptsDir = ""
  60.  
  61. #############################################################################
  62.  
  63. try:
  64.     import colladaImEx.cstartup
  65.     if Blender.Get('scriptsdir') is None and Blender.Get('uscriptsdir') is None:
  66.         if scriptsDir == '' or scriptsDir is None:
  67.             Blender.Draw.PupMenu("Cannot find folder %t | Please set path in file 'colladaImport14.py'")
  68.             error = True
  69.         else:
  70.             loc = scriptsDir
  71.     else:
  72.         loc = ""
  73. except ImportError:
  74.     # Check if full version of python is installed:
  75.     try:
  76.         import os
  77.         pythonFull = True
  78.     except ImportError:
  79.         pythonFull = False
  80.  
  81.     if not pythonFull:
  82.         from sys import version_info
  83.         version = '%s.%s' % version_info[0:2]
  84.         print """
  85. This script requires the xml module that is part of a
  86. default standalone Python install.
  87.  
  88. To run the collada importer and exporter you need to have
  89. Python version %s installed in your system. It can be downloaded from:
  90.  
  91. http://www.python.org
  92.  
  93. Notes:
  94. - The minor (third) version number doesn't matter, you can have either
  95. Python %s.1 or %s.2 or higher.
  96. - If you do have Python %s installed and still can't run the scripts, then
  97. make sure Blender's Python interpreter is finding the standalone modules
  98. (run 'System Information' from Blender's Help -> System menu).
  99. """ % (version, version, version, version)
  100.         Blender.Draw.PupMenu("Please install full version of python %t | Check the console for more info")
  101.         error = True
  102.     else:
  103.         if scriptsDir == "":
  104.             Blender.Draw.PupMenu("Cannot find folder %t | Please set path in file 'colladaImport14.py'")
  105.             error = True
  106.         else:
  107.             if scriptsDir not in sys.path:
  108.                 sys.path.append(scriptsDir)
  109.             try:
  110.                 import colladaImEx.cstartup
  111.                 loc = scriptsDir
  112.             except:
  113.                 Blender.Draw.PupMenu("Cannot find colladaImEx files %t | Please make sure the path is correct in file 'colladaImport14.py'")
  114.                 error = True
  115. except StandardError:
  116.     error = True
  117.  
  118. debug = False #or True
  119. if debug:
  120.     #hack for debug outputs to the console
  121.     reload(colladaImEx.cstartup)
  122.     colladaImEx.cstartup.Main(True, loc)
  123. elif not error:
  124.     try:
  125.         reload(colladaImEx.cstartup)
  126.         colladaImEx.cstartup.Main(True, loc)
  127.     except StandardError:
  128.         pass
  129.  
  130. """a try to receive error messages to the console:
  131. except:
  132.     print 'deb: PROBLEM !!!!!' #-------
  133.     #print sys.exc_info()[1]
  134.     #print sys.exc_info()
  135.     print sys.exc_type, sys.exc_value #-------
  136.     #traceback.print_exc(file=sys.stdout)
  137. """
  138.